<!--#include file="../nav/admin_top.php" --> 
<style type="text/css">
 

 


</style>	
<script type="text/javascript">
var url_save = '/admin_sendpi/add'; 
var url_return_modify = '/admin_sendpi/modify?id=';  
var url_return = '/admin_sendpi/index';  

$().ready(function(){  
	showLoading();  
  $('#code').focus();
	
	o2js.build('dates'); 
	o2js.build('jscalendar');
	Calendar.setup({
		inputField:'senddate',
		button:'senddate_slt',
		ifFormat:"%Y-%m-%d", 
		singleClick:true
	}); 
	
}); 

function fnReturn(){
	fnConfirm({
		str:'确认取消？',
		func_true:function(){
			jumpTo(url_return);
		},
		func_false:function(){
			return false;
		}
	});
	
}	
/* 保存 */
function fnSave(){
	var onsource = '1';
	if($('#onsource_no').attr('checked')){
		onsource = '0';
	}
	var form = {
		onsource:onsource,
		code:$('#code').val(),
		senddate:$('#senddate').val(),
		remark:$('#remark').val()
	};
	/* 验证 */
	if($.trim(form.code) == ''){
		alert('请输入【配送批次编号】');
		$('#code').focus();
		return false;
	}
	if($.trim(form.senddate) == ''){
		alert('请选择【配送日期】');
		$('#senddate').focus();
		return false;
	}
  $('button').attr('disabled','disabled');
	$.ajax({
		async:true,
		type:'post',
		url:url_save,
		data:{
			form:JSON.encode(form)
		},
		success:function(e){
  		$('button').attr('disabled','');
			var ok = errorHandler(e);
			if(ok){
				jumpTo(url_return_modify+ok.id);
			}
		}
	});
}

 
</script>
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">配送批次 - 添加配送批次</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div>

<div class="blockdiv">
	<div class="titlediv">基本信息</div>
	<table class="mytable" > 
		<tr >
			<td class="mylabel"><span class="red">*</span>是否建立溯源信息：</td>
			<td class="myinfo" >
				<input type="radio" name="onsource"  id="onsource_yes" disabled="disabled" value="1"  /><label for="onsource_yes" style="color:#006600">需要</label>
				<input style="margin-left:50px;" type="radio" disabled="disabled" name="onsource" id="onsource_no" checked="checked" value="0" /><label for="onsource_no" style="color:#666666">不需要</label>
			</td> 
		</tr>
		<tr>
			<td class="mylabel"><span class="red">*</span>配送批次编号：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="code" name="code" maxlength="100" style="width:200px" /> 
			</td> 
		</tr>
		<tr>
			<td class="mylabel"><span class="red">*</span>配送日期：</td>
			<td class="myinfo" >
				<input type="text" class="textBox" id="senddate" name="senddate" readonly="readonly" maxlength="20" style="width:80px" />
				<input id="senddate_slt" class="btnicon_calendar" type="button">
			</td>
		</tr>
		<tr>
			<td class="mylabel">备注说明：</td>
			<td class="myinfo" colspan="1" >
				<textarea id="remark" name="remark" class="textBox" style="height:100px;width:80%;"></textarea>
			</td>
		</tr>  
	</table> 
</div> 
			
<div  class="button_div">
		<button class="btn_save" onclick="fnSave()">保 存</button>
		<span class="gray">或</span> 
		<a href="javascript:fnReturn()">取消</a>
</div>  
<!--#include file="../nav/admin_bottom.php" -->